<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
   
    <meta name="description" content="">
    <meta name="author" content="">

    <title>后台登录</title>

    <!-- Bootstrap Core CSS -->
    <link href="{{asset('AdminCss/bower_components/bootstrap/dist/css/bootstrap.min.css')}}" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="{{asset('AdminCss/bower_components/metisMenu/dist/metisMenu.min.css')}}" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="{{asset('AdminCss/dist/css/sb-admin-2.css')}}" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="{{asset('AdminCss/bower_components/font-awesome/css/font-awesome.min.css')}}" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js')}} IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js')}} doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js')}}"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js')}}/1.4.2/respond.min.js')}}"></script>
    <![endif]-->

</head>

<body  style="background:url(HemeCss/images/1481870204.jpg)">
    
    </div>
  
    <div class="container">
        <div class="row">
            <div class="col-md-4 col-md-offset-4">
                <div class="login-panel panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title" style="text-align:center;font-size:26px;font-weight:bold;">登　　录</h3>
                    </div>
                    <div class="panel-body">
                        <form role="form" action="{{url('/Admin/user/deng')}}" id="myform" method="post">
                            <fieldset>
                                <div class="form-group" id="dataTables-example_length">
                                        
                                            <select name="auth" aria-controls="dataTables-example" class="form-control input-sm">
                                                <option value="0" @if(!empty($list['num']) && $list['num'] == 0 ){ selected } @endif)>超级管理员</option>
                                                <option value="1" @if(!empty($list['num']) && $list['num'] == 1 ){ selected } @endif)>普通员工</option>
                                                <option value="2" @if(!empty($list['num']) && $list['num'] == 2 ){ selected } @endif)>普通会员</option>
                                                
                                            </select>
                                </div>
                                <div class="form-group">
                                  
                                    <input class="form-control" placeholder="请输入6-18位用户名" name="uname" type="text" autofocus>
                                    <div id="nameinfo" style="display:none"></div>
                                 
                                </div>
                                <div class="form-group">
                                  
                                    <input class="form-control" placeholder="请输入6-18位密码" name="upwd" type="password" value="">
                                    <div id="pass" style="display:none"></div>
                                    
                                </div>
                                @if(session('success'))
                                  <div class="alert alert-success alert-dismissable">
                                  <div aria-hidden="true" data-dismiss="alert" class="close"></div>
                                {{session('success')}}
                                  </div>
                                @endif
                                @if(session('error'))
                                <div class="alert alert-danger alert-dismissable" style="margin-top:3px;margin-left:1px;color:red;">
                                    
                                    {{session('error')}}
                                </div>
                                @endif
                               
                                <!-- Change this to a button or input when using this as a form -->
                               <button class="btn btn-primary btn-lg btn-block" >登　　录</button>
                            </fieldset>
                            {{csrf_field()}}
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- jQuery -->
    <script src="{{asset('AdminCss/bower_components/jquery/dist/jquery.min.js')}}"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="{{asset('AdminCss/bower_components/bootstrap/dist/js/bootstrap.min.js')}}"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="{{asset('AdminCss/bower_components/metisMenu/dist/metisMenu.min.js')}}"></script>

    <!-- Custom Theme JavaScript -->
    <script src="{{asset('AdminCss/dist/js/sb-admin-2.js')}}"></script>
    <script type="text/javascript">

        //获取表单对象
         var myform = document.getElementById('myform');
       
        //获取div元素
         var nameinfo = document.getElementById('nameinfo');
         var pass = document.getElementById('pass');


         var CUSER = false;
         var CPASS = false;
         
        //绑定表单事件
        $('form').submit(function(){
            //触发所有的丧失焦点事件
            $('input').trigger('blur');
            //判断是否全部成功
            if(CUSER && CPASS){
                return true;
            }

            return false;
        })
        

            
        //获取表单用户名丧失焦点事件
        myform.uname.onblur = function()
        {
               
                  //获取输入的内容
                   var v = this.value;
                   var reg = /^\w{6,18}$/;
                   if(reg.test(v)){
                
                   nameinfo.style.display = 'none';
                   this.style.border = '#c6c6c6 1px solid'; 
                   CUSER = true;
                }else{
                   
                   this.style.border = 'red 1px solid'; 
                   nameinfo.innerHTML = '输入的用户名不符合要求';
                   nameinfo.style.color = 'red';
                   nameinfo.style.display = 'block';
                   CUSER = false;
                }
        }

        //绑定表单密码的失去焦点事件
         myform.upwd.onblur = function()
        {
           
                //获取输入的内容
                var v = this.value;
                var reg = /^\w{6,18}$/;
                if(reg.test(v)){
                   pass.style.display = 'none';
                   this.style.border = '#c6c6c6 1px solid';
                    CPASS = true;
                }else{
                   this.style.border = 'red 1px solid'; 
                   pass.innerHTML = '输入的密码不符合要求';
                   pass.style.color = 'red';
                   pass.style.display = 'block';
                 CPASS = false;
                }
        }

        
    </script>
</body>

</html>
